<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div class="row">
	<div class="col-lg-12">
		<h3 class="page-header">新增日常工作记录</h3>
	</div>
	
</div>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
			<button type="button" class="btn btn-primary" id="saveBtn">保存</button>
			&nbsp;<a href="<c:url value="/dailyRecord/index.htm"/>"><button type="button" class="btn btn-primary">取消</button></a>
			</div>
			<!-- /.panel-heading -->
			<div class="panel-body">
				<div class="row">
                    <div class="col-lg-6">
                        <form id="form1">
                            <div class="form-group">
                                <label>日常记录名称</label>
                                <input name="dailyRecordName" value="我的日常工作记录" class="form-control">
                                <!-- <p class="help-block">Example block-level help text here.</p> -->
                            </div>
                            <div class="form-group">
                                <label>日常记录日期</label>
                                <input id="recordDate" name="dailyRecordDate" value="2016-05-16" class="form-control">
                                <!-- <p class="help-block">Example block-level help text here.</p> -->
                            </div>
                            <div class="form-group">
                                <label>日常记录类型：</label>
                                <div class="checkbox">
                                        <label><input type="radio" checked name="dailyRecordType" value="工作成绩" />工作成绩</label>
		                                <label><input type="radio"  name="dailyRecordType" value="工作不足" />工作不足</label>
		                                <label><input type="radio"  name="dailyRecordType" value="培训要求" />培训要求</label>
		                        </div>
		                    </div>
		                    
                            <div class="form-group">
                                <label>日常记录内容</label>
                                <textarea name="dailyRecordContent" value="" class="form-control" rows="3">日常记录内容......</textarea>
                            </div>
                            
                        </form>
                    </div>
                    <!-- /.col-lg-6 (nested) -->
                    
                    <!-- /.col-lg-6 (nested) -->
                </div>
			</div>
		</div>
	</div>
</div>
</body>
</html>
<script>
$(function() {
	$('#recordDate').datepicker({
        language: 'zh-CN',
        autoclose: true,
        todayHighlight: true,
        format: 'yyyy-mm-dd'
    });
	$("#saveBtn").click(function() {
		$.ajax({
			url : '<c:url value="/dailyRecord/add.json"/>',
			dataType : "json",
			type : "post",
			data : $("#form1").serialize(),
			success : function(data) {
				if (data.hasErrors) {
					alert(data.errors[0]);
				} else {
					window.location.href = '<c:url value="/dailyRecord/index.htm"/>';
				}
			}
		});
	});
});
</script>